
---
apiVersion: v1
kind: Namespace
metadata:
  name: not-kuma-demo
  labels:
    kuma.io/sidecar-injection: enabled
---
apiVersion: v1
kind: Service
metadata:
  name: redis
  namespace: not-kuma-demo
spec:
  selector:
    app: redis
  ports:
  - protocol: TCP
    port: 6379
---
apiVersion: v1
kind: Service
metadata:
  name: demo-app
  namespace: not-kuma-demo
spec:
  selector:
    app: demo-app
  ports:
  - protocol: TCP
    appProtocol: http
    port: 5000
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: redis
  namespace: not-kuma-demo
spec:
  selector:
    matchLabels:
      app: redis
  replicas: 1
  template:
    metadata:
      labels:
        app: redis
    spec:
      containers:
        - name: redis
          image: "redis"
          ports:
            - name: tcp
              containerPort: 6379
          lifecycle:
            preStop: # delay shutdown to support graceful mesh leave
              exec:
                command: ["/bin/sleep", "30"]
            postStart:
              exec:
                command: ["/usr/local/bin/redis-cli", "set", "zone", "aws"]
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: demo-app
  namespace: not-kuma-demo
spec:
  selector:
    matchLabels:
      app: demo-app
  replicas: 1
  template:
    metadata:
      labels:
        app: demo-app
    spec:
      containers:
        - name: demo-app
          image: "kumahq/kuma-demo"
          env:
            - name: REDIS_HOST
              value: "redis.not-kuma-demo.svc.cluster.local"
            - name: REDIS_PORT
              value: "6379"
            - name: APP_VERSION
              value: "1.0"
            - name: APP_COLOR
              value: "#efefef"
          ports:
            - name: http
              containerPort: 5000
---
apiVersion: kuma.io/v1alpha1
kind: MeshGateway
mesh: default
metadata:
  name: demo-app
  labels:
    kuma.io/origin: zone
spec:
  conf:
    listeners:
    - port: 80
      protocol: HTTP
  selectors:
  - match:
      kuma.io/service: demo-app_gateway
---
apiVersion: kuma.io/v1alpha1
kind: MeshGatewayInstance
metadata:
  name: demo-app-gateway
  namespace: not-kuma-demo
spec:
  replicas: 1
  serviceType: LoadBalancer
  tags:
    kuma.io/service: demo-app_gateway
---
apiVersion: kuma.io/v1alpha1
kind: MeshHTTPRoute
metadata:
  name: demo-app
  namespace: kuma-system
  labels:
    kuma.io/origin: zone
    kuma.io/mesh: default
spec:
  targetRef:
    kind: MeshGateway
    name: demo-app
  to:
    - targetRef:
        kind: Mesh
      rules:
        - matches:
            - path:
                type: PathPrefix
                value: "/"
          default:
            backendRefs:
              - kind: MeshService
                name: demo-app_not-kuma-demo_svc_5000
